package com.testing.class2;

/**
 * @Classname BitMath
 * @Description 类型说明
 * @Date 2021/4/12 20:46
 * @Created by 特斯汀Roy
 */
public class BitMath {
    public static void main(String[] args) {
        int a = 37;
        int b = 87;
        int andR = a & b;
        int orR = a | b;
        int nsR = a ^ b;

        System.out.println("与结果:" + andR);
        System.out.println("或结果:" + orR);
        System.out.println("异或结果:" + nsR);


        int anr = a ^ nsR;
        int bnr = b ^ nsR;
        System.out.println("a与异或结果异或：" + anr);
        System.out.println("b与异或结果异或" + bnr);


        int lefta2 =(byte)( a << 2);
        int leftb2 = b >> 2;

        System.out.println(lefta2);
        System.out.println(leftb2);


        int lefta1=a<<26;
        int leftb1=b>>1;
        System.out.println("37左移一位"+lefta1);
        System.out.println("87右移一位："+leftb1);

    }

}
